package com.itchu.system.controller;

import com.itchu.auth.config.OnlineCounter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.*;

@Controller
@RequestMapping("/statistic")
public class StatisticsController {
    @Autowired
    private OnlineCounter onlineCounter;

    @GetMapping("/onlinecounter")
    public ResponseEntity<Integer> getOnlineCounter() {
        return ResponseEntity.ok(onlineCounter.getOnlineCounter());
    };


    @GetMapping("/total")
    public ResponseEntity<Long> getTotal() {

        Long total = onlineCounter.getTotalVisit();
        return ResponseEntity.ok(total);
    }
}
